<!DOCTYPE html>
<html>
  {% extends 'base.html' %}

  {% block title %}
    oec-hardware
  {% endblock %}
  
  {% block page_content %}
    <div class="navbar navbar-inverse" role="navigation">
      <div class="container">
        <div class="navbar-menu">
          <a class="btn" href="/results/{{ host }}/{{ id }}/{{ job }}">Summary</a>
          <a class="btn" href="/results/{{ host }}/{{ id }}/{{ job }}/devices">Devices</a>
          <a class="btn" href="/results/{{ host }}/{{ id }}/{{ job }}/logs/job">Runtime</a>
          <a class="btn" href="/results/{{ host }}/{{ id }}/{{ job }}/attachment">Attachment</a>
        </div>
      </div>
    </div>
    <div class="table-env">
      <table class="table table-striped table-hover">
        <thead>
          <th colspan="2">
            <p>Environment</p>
          </th>
        </thead>
        <tbody>
          {% for key in info %}
            <tr>
              <td width="50%">{{ key }}</td>
              <td>{{ info.get(key) }}</td>
            </tr>
          {% endfor %}
        </tbody>
      </table>
    </div>

    <div class="table-detail">
      <table class="table table-striped table-hover">
        <thead>
          <th>
            <p>Testcase</p>
          </th>
          {% if json_results == "factory.json" %}
          <th>
            <p>Device</p>
          </th>
          <th>
            <p>driverName</p>
          </th>
          <th>
            <p>driverVersion</p>
          </th>
          <th>
            <p>chipModel</p>
          </th>
          <th>
            <p>boardModel</p>
          </th>
          {% endif %}
          <th>
            <p>Result</p>
          </th>
        </thead>
        <tbody>
          {% for d in results %}
            <tr>
              {% set testcase = d.get('name') %}

              {% if testcase == 'ethernet' %}
                {% set int = d.get('device').get('INTERFACE', '') %}
              {% else %}
                {% set int = d.get('device').get('PCI_SLOT_NAME', '') %}
              {% endif %}

              {% if d.get('run') %}
                {% set result = d.get('status') %}
              {% else %}
                {% set result = '' %}
              {% endif %}

              <td>{{ testcase }}</td>
              {% if json_results == "factory.json" %}
              <td>
                <a href="/results/{{ host }}/{{ id }}/{{ job }}/devices/{{ int }}">{{ int }}</a>
              </td>
              <td>{{ d.get('driverName', '') }}</td>
              <td>{{ d.get('driverVersion', '') }}</td>
              <td>{{ d.get('chipModel', '') }}</td>
              <td>{{ d.get('boardModel', '') }}</td>
              {% endif %}
              <td>
                <a href="/results/{{ host }}/{{ id }}/{{ job }}/logs/{{ testcase }}">{{ result }}</a>
              </td>
            </tr>
          {% endfor %}
        </tbody>
      </table>
    </div>
  {% endblock %}
</html>
